package com.tamir.template.exception;

/**
 * @author : tanggh
 * @description :〈描述〉
 * @date : 2016/10/27
 */
public enum Errors
{
    syntax_error  ("10000","Syntax error"),
    express_not_registered ("10001", "express not registered"),
    syntax_error_tag_mismatch ("10002", "Tag mismatch"),
    logic_type_value_handle_not_registered("10003", "value handle for logic type not registered"),
    logic_handle_parse_not_registered("10003", "parse handle for logic type not registered"),
    value_not_found("10004", "value not found"),
    express_value_type_not_match("10005", "express and the type of value is not match"),
    index_out_of_bounds("10006", "index out of bounds");

    private String errorCode;
    private String errorMsg;

    /**
     * <p>Title: </p>
     * <p>Description: </p>
     * @param errorCode
     * @param errorMsg
     */
    private Errors(String errorCode, String errorMsg){
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    /**
     * @Title: getErrorCode
     * @Description: TODO(这里用一句话描述这个方法的作用)
     * @param @return 设定文件
     * @return String 返回类型
     * @throws
     */
    public String getErrorCode() {
        return errorCode;
    }

    /**
     * @Title: getErrorMsg
     * @Description: TODO(这里用一句话描述这个方法的作用)
     * @param @return 设定文件
     * @return String 返回类型
     * @throws
     */
    public String getErrorMsg() {
        return errorMsg;
    }

    /**
     * @Title: toJson
     * @Description: TODO(这里用一句话描述这个方法的作用)
     * @param @return 设定文件
     * @return String 返回类型
     * @throws
     */
    public String toJson(){
        return "{\"errcode\":\"" + errorCode + "\",\"msg\":\"" + errorMsg + "\"}";
    }
}
